import React, { Component } from 'react';
import style from "./question.module.css"
import { RightOutlined ,LikeFilled} from '@ant-design/icons';
import {withRouter} from "react-router-dom"

class question extends Component {
    state={
        dianzan:false,
        zan:0
    }
    render() {
        return (
            <div className={style.question}>
                <div className={style.questionTil}>
                    <span>大家都在问</span>
                    <span className={style.all}>查看全部<RightOutlined style={{color:"#9a9a9a"}}/></span>
                </div>

                <div className={style.questionBox}>
                    <div>
                        <div className={style.questionTop}>
                            <p>问</p>
                            <p>和泓海棠府装修和样板房一样吗</p>
                        </div>
                        <div className={style.answerBox}>
                            <div className={style.answerImg}>
                                头像
                            </div>
                            <div className={style.answerCon}>
                                <div className={style.answerTag}>置业顾问</div>
                                <p className={style.answerDetails}>是的呢</p>
                                <div className={style.answerBottom}>
                                    <p>2020-11-30 15:10</p>
                                    <p>
                                        {!this.state.dianzan&&<LikeFilled  onClick={(e)=>{
                                            this.state.zan+=1
                                            this.state.dianzan=!this.state.dianzan
                                            e.stopPropagation()
                                            this.setState({})
                                        }}/>}
                                        {this.state.dianzan&&<LikeFilled  className={style.zan} onClick={(e)=>{
                                            this.state.zan-=1
                                            this.state.dianzan=!this.state.dianzan
                                            e.stopPropagation()
                                            this.setState({})
                                        }}/>}

                                        {this.state.zan}
                                    </p>
                                </div>
                            </div>
                        </div>

                        <div className={style.askQuestion} onClick={()=>{
                        this.props.history.push("/center/ask")}}>
                            我要提问
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}

export default withRouter(question);